import { ref,reactive} from 'vue'

import type {FormRules } from "element-plus";


//添加修改用户信息
export interface UserSaveOrUpdateParam {
    userName:string,
    nickName:string,
    phone:string,
    email:string,
    isEnabled:string,
    expiredDate:string,
    departmentId:string,
    password:string,
    roleIds:[]
}


//添加修改对象
export const userSaveOrUpdateParam = reactive<UserSaveOrUpdateParam>({
    userName: '',
    nickName: '',
    phone: '',
    email: '',
    isEnabled :'NORMAL',
    expiredDate: '',
    departmentId: '',
    password: '',
    roleIds:[]
});




export function userFromInfo(fromObj:any){
    userSaveOrUpdateParam.userName=fromObj!=null?fromObj.userName:"";
    userSaveOrUpdateParam.nickName=fromObj!=null?fromObj.nickName:"";
    userSaveOrUpdateParam.phone=fromObj!=null?fromObj.phone:"";
    userSaveOrUpdateParam.email=fromObj!=null?fromObj.email:"";
    userSaveOrUpdateParam.isEnabled=fromObj!=null?fromObj.isEnabled:"NORMAL";
    userSaveOrUpdateParam.expiredDate=fromObj!=null?fromObj.expiredDate:"";
    userSaveOrUpdateParam.departmentId=fromObj!=null?fromObj.departmentId:"";
    userSaveOrUpdateParam.roleIds=fromObj!=null?fromObj.roleIds:[];
    userSaveOrUpdateParam.password="";
}
